import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import 'material-icons/iconfont/material-icons.css';

Vue.config.productionTip = false

import axios from 'axios'  //引入axios
//用axios的拦截器,加上请求头
axios.interceptors.request.use(
  config => {
    let jwt = localStorage.getItem("token");
    if (jwt) {
      config.headers.token = jwt;
    }
    return config;
  }
)

Vue.prototype.$axios = axios //把axios配置全局的变量，变量名是$axios

Vue.use(ElementUI);

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
